package mr.zhang.controller;

import mr.zhang.dao.domain.Merchant;
import mr.zhang.service.TestMyBatisService;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;


public class UpdatepMerchantController extends AbstractController {
	
	private String toview;
	
	private TestMyBatisService testMyBatisService;
	
	
	
	
	public String getToview() {
		return toview;
	}

	public void setToview(String toview) {
		this.toview = toview;
	}

	public TestMyBatisService getTestMyBatisService() {
		return testMyBatisService;
	}

	public void setTestMyBatisService(TestMyBatisService testMyBatisService) {
		this.testMyBatisService = testMyBatisService;
	}





	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		
		Map<String,Object> model = new HashMap<String,Object>();
		
		int id = Integer.parseInt(request.getParameter("id"));
		
		Merchant merchant = this.testMyBatisService.queryMerchantById(id);
		
		
		model.put("merchant", merchant);
		
		
		
		return new ModelAndView(getToview(),model);
	}

}
